﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WmsApp.WindowControl;

namespace WmsApp.EntityControl
{
    public class PropertyChangedHandler
    {
       
        public static void EntityObjectPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            var pi = sender.GetType().GetProperty(Constant.WcfEntityStateName);
            if (e.PropertyName != Constant.WcfEntityStateName)
            {
                var es = (System.Data.EntityState)pi.GetValue(sender, null);
                if( es != System.Data.EntityState.Added)
                {
                    pi.SetValue(sender, System.Data.EntityState.Modified,null);
                }
            }
        }
    }
}
